package com.allenkerr.model;

import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.NotBlank;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

/**
 * Created by 小柯(Allen Kerr) on 17.6.3 22:52.
 */
@Entity//与数据库的表对应
//解决问题：No serializer found for class org.hibernate.proxy.model.javassist.Javassist?
//参考：https://stackoverflow.com/questions/24994440/no-serializer-found-for-class-org-hibernate-proxy-pojo-javassist-javassist
@JsonIgnoreProperties({"hibernateLazyInitializer", "handler"})
public class Girl implements Serializable {

    @Id//表示主键
    @GeneratedValue//表示自增长
    private Integer id;

    private String name;

    //@NotNull(message = "罩杯必须填写！")
    @NotBlank(message = "罩杯必须填写！")
    private String cupSize;

    @Min(value = 18, message = "未成年少女禁止入内！")
    private Integer age;

    public Girl() {
    }

    public Girl(String name, String cupSize, Integer age) {
        this.name = name;
        this.cupSize = cupSize;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Girl{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", cupSize='" + cupSize + '\'' +
                ", age=" + age +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getCupSize() {
        return cupSize;
    }

    public void setCupSize(String cupSize) {
        this.cupSize = cupSize;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }
}
